package Games;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Line2D;

import Client.GraphicPiece;

public class XPiece implements GraphicPiece {

	final static BasicStroke wideStroke = new BasicStroke(8.0f);
	private int x, y, width, height;
	private int padding = 10;
	
	public XPiece(int x, int y, int width, int height) 
	{
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height; 
	}
	
	@Override
	public void draw(Graphics g) {
            int thickness = 3;
            int size = width - 2 * padding - thickness;

            int x1 = x * width + padding;
            int y1 = y * width + padding;
            int x2 = x * width + padding + size;
            int y2 = y * width + padding + size;

            Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setPaint(Color.gray);
            g2.setStroke(wideStroke);

            for(int i = 0; i < thickness; i++) {
                // Het echte tekenen van de steen
                g2.draw(new Line2D.Float(x1 + i, y1, x2 + i, y2));
                g2.draw(new Line2D.Float(x2 + i, y1, x1 + i, y2));
            }
	}
}
